package com.kaching.twitter

import javax.jdo.annotations.{Extension, Persistent, IdGeneratorStrategy, PrimaryKey, PersistenceCapable, IdentityType}
import com.google.appengine.api.datastore.Key

/**
 * The id is the twitter ID
 */
@PersistenceCapable{val identityType = IdentityType.APPLICATION, val detachable="true"}
class KCUser (
  @PrimaryKey 
  @Persistent{val valueStrategy = IdGeneratorStrategy.IDENTITY} 
  var key: Key,

  @Persistent 
  var twitterId: Int,
  
  @Persistent 
  var twitterName: String,
  
  @Persistent 
  var twitterFullName: String) {
  
  @Persistent 
  var kcId: Long = -1
  
  @Persistent 
  var kcKey: String = null
}

object KCUser{
  def getKeyByTwitterId(id: Int) = "tw" + id
}
